<template>
  <div class="aside">
    <el-menu
      :default-active="$route.path"
      class="el-menu-vertical-demo"
      :collapse="$store.state.nav.isCollapse"
      router
    >
      <el-menu-item
        v-for="menu in $store.state.auth.menus" :key="menu.path"
        :index="menu.path"
        @click="setCurrenRoute(menu)"
        >
        <i :class="menu.icon"></i>
        <span slot="title">{{menu.label}}</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  methods: {
    setCurrenRoute (route) {
      // 设置当前的路由
      // 设置tabs
      this.$store.commit('nav/setTabs', route)
    }
  }
}
</script>

<style lang="scss" scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
::v-deep .el-menu {
  background: #303030;
  .el-menu-item-group__title,
  .el-submenu__title,
  .el-menu-item {
    color: #fff;
  }
}
.el-submenu__title i,
.el-menu-item i {
  color: #fff;
}
::v-deep .el-menu-item:focus,
::v-deep .el-menu-item:hover, ::v-deep .el-submenu__title:hover, ::v-deep .el-menu-item.is-active{
  outline: 0;
  background-color: #434b57 ;
}
</style>
